package com.godme.string;

public class BruteForce {


    public static int find(String mainString, String matchString){
        int startIndex = 0;
        int matchLength = matchString.length();
        int endIndex = mainString.length() - matchLength;
        offset: while (startIndex <= endIndex){
            for(int index=0; index< matchLength; index++){
                if(!(mainString.charAt(startIndex + index) == matchString.charAt(index))) {
                    startIndex++;
                    continue offset;
                }
            }
            return startIndex;
        }
        return -1;
    }


    public static void main(String[] args) {
        System.err.println(find("aaaaaaabc", "bc"));
    }


}
